package com.service.impl;

import com.mapper.TeacherMapper;
import com.pojo.Teacher;
import com.service.TeacherService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/3/24.
 */
@Service
public class TeacherServiceImpl implements TeacherService {
    @Resource
    private TeacherMapper teacherMapper;

    @Override
    public boolean addTeacher(Teacher teacher) {
        return teacherMapper.insert(teacher) > 0 ? true : false;
    }

    @Override
    public boolean delTeacherById(Integer teacherId) {
        return teacherMapper.deleteByPrimaryKey(teacherId) > 0 ? true : false;
    }

    @Override
    public boolean updateTeacher(Teacher teacher) {
        return teacherMapper.updateByPrimaryKeySelective(teacher) > 0 ? true : false;
    }

    @Override
    public List<Teacher> findAllTeacher() {
        return teacherMapper.selectAll();
    }

    @Override
    public Teacher findTeacherById(Integer teacherId) {
        return teacherMapper.selectByPrimaryKey(teacherId);
    }
}
